var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("Sounds"),
    i = cc._decorator,
    s = i.ccclass,
    c = i.property,
    l = i.menu,
    u = i.requireComponent,
    p = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (e.viewNode = null), (e.isPlay = !0), e;
        }
        var o;
        return (
            n(e, t),
            (o = e),
            (e.prototype.onEnable = function () {
                this.node.on("click", this.callback, this);
            }),
            (e.prototype.callback = function () {
                if (!this.check || this.check.fun.call(this.check.the)) {
                    if (
                        (this.node.convertToWorldSpaceAR(o.nodePoint, o.woeldPoint),
                        cc.Canvas.instance.node.convertToNodeSpaceAR(o.woeldPoint, o.out),
                        null == this.viewNode)
                    )
                        throw new Error("you not seting OnClick Component viewNode property");
                    var t = this.clickName ? this.clickName : this.node.name;
                    void 0 === this.clickpar
                        ? this.viewNode.emit("onClick", t)
                        : this.viewNode.emit("onClick", t, this.clickpar),
                        this.isPlay && a.Sounds.playFX("按钮");
                }
            }),
            (e.prototype.onDisable = function () {
                this.node.off("click", this.callback, this);
            }),
            (e.prototype.resetInEditor = function () {
                this.getComponent(cc.Button).transition = cc.Button.Transition.SCALE;
            }),
            (e.nodePoint = cc.v2()),
            (e.woeldPoint = cc.v2()),
            (e.out = cc.v2()),
            r([c({type: cc.Node, displayName: "接受点击的面板"})], e.prototype, "viewNode", void 0),
            r([c({displayName: "是否播放音效"})], e.prototype, "isPlay", void 0),
            (e = o = r([s, l("面板/OnClick"), u(cc.Button)], e))
        );
    })(cc.Component);
o.default = p;
